home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / SvII-1.lha / SViewII / ARexx-Scripts / MetaView.rx < prev    next >
Text File  |  1999-02-20  |  2KB  |  92 lines

  1. /* Load a vector graphics into MetaView, then */
  2. /* save it to ILBM and load it into SViewII   */
  3. /* written in 1997-98 by Andreas R. Kleinert  */
  4.  
  5. METAVIEW = 'hd5:MetaView/MetaView'    /* Please adjust the path                */
  6.                                       /* maybe also the "Bilder:" assign below */
  7.  
  8. OPTIONS RESULTS
  9. SIGNAL ON FAILURE
  10. SIGNAL ON SYNTAX
  11.  
  12. /*
  13. ** Looking for our start process
  14. */
  15.  
  16. SVPORT = 'SViewII.rx'
  17.  
  18. IF ~SHOW('P',SVPORT) THEN DO
  19.     say "Please start SViewII before!"
  20.     EXIT
  21. end
  22.  
  23. /*
  24. ** Create a new Metaview process:
  25. ** first look for the already running processes;
  26. ** the new port will be the next one
  27. */
  28.  
  29. do NUMBER = 0 to 20
  30.     if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
  31.     leave
  32. end
  33.  
  34. /*
  35. ** Searching for MetaView: 1. our path above,
  36. **    2. path in env:MetaView.path
  37. ** or 3. you must have an assign "MetaView:"
  38. */
  39.  
  40. if (EXISTS(METAVIEW)=0) then do
  41.     if OPEN("MVVAR","env:MetaView.path","Read") then do
  42.         METAVIEW = READLN("MVVAR")
  43.     end
  44.     if (EXISTS(METAVIEW)=0) then do
  45.         METAVIEW = "MetaView:MetaView"
  46.     end
  47. end
  48.  
  49. /*
  50. ** Enable warnings for WaitForPort
  51. */
  52.  
  53. OPTIONS FAILAT 5
  54. ADDRESS COMMAND
  55.     "run " || METAVIEW || " NODISPLAY"
  56.     MVPORT = "METAVIEW." || NUMBER
  57.     "WaitForPort " || MVPORT
  58.  
  59. /*
  60. ** Ignore the other errors
  61. */
  62.  
  63. OPTIONS FAILAT 21
  64.  
  65. /*
  66. ** Do all needed things with MetaView (LOAD,SAVE,QUIT...)
  67. */
  68.  
  69. ADDRESS VALUE MVPORT
  70.     REQUESTFILE "Bilder:"
  71.     FILENAME = result
  72.     LOAD FILENAME
  73.     SAVE "t:mv_sv_import.ilbm" AS ILBM
  74.     QUIT
  75.  
  76. /*
  77. **  Import the temporary file in application
  78. */
  79.  
  80. ADDRESS VALUE SVPORT
  81.     'LOAD=t:mv_sv_import.ilbm'
  82.     EXIT
  83.  
  84. FAILURE:
  85.     ADDRESS COMMAND
  86.     REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
  87.     EXIT
  88.  
  89. SYNTAX:
  90.     say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
  91.     EXIT
  92.